<?php
/**
 * @file $HeadURL: attendanceworkcycle.php $
 * @author $Author: ZhangFan (zhangfan1@haibao.com) $
 * @date $Date: 2016-1-14 $
 * @brief
 */

namespace haibao\cms\data\attendance;

class AttendanceWorkCycle extends \haibao\cms\data\BaseMysql{
    public function __construct(){
        parent::__construct('\haibao\cms\model\data\attendance\AttendanceWorkCycle');
    }
    public function deleteWorkCycle($jobNums){
        $jobNumsArr = explode(',',$jobNums);
        $jobNumsStr = preg_replace('/\d+/','%s',$jobNums);
        $sql = "delete from AttendanceWorkCycle where JobNum in (".$jobNumsStr.")";
        $this->query($sql,$jobNumsArr);
    }
    public function getWorkCycle($jobNum){
        $weekCycle = 0;
        $sql = "select WeekCycle from AttendanceWorkCycle where JobNum=%s";
        $result = $this->query($sql,array($jobNum));
        while($result->fetch_assoc()){
            $weekCycle = $result->getData('WeekCycle');
        }
        return $weekCycle;
    }
}